package com.xjl.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xjl.domain.ResponseResult;
import com.xjl.domain.entity.Role;
import com.xjl.mapper.RoleMapper;
import com.xjl.service.RoleService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * 角色信息表(Role)表服务实现类
 *
 * @author makejava
 * @since 2023-08-21 19:36:05
 */
@Service("roleService")
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements RoleService {

    @Override
    public List<String> selectRoleKeyByUserId(Long id) {
        //判断是否为管理员 ，如果是 返回集合中只需要admin
        if (id == 1L){
            List<String> roleKeys = new ArrayList<>();
            roleKeys.add("admin");
            return roleKeys;
        }

        //否则查询当前用户所具有的权限信息
        return getBaseMapper().selectRoleKeyByUserId(id);

    }
}
